<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/

defined('ANS') or die();

class Vars {
	public $path;
	public $route;
	public $route_config;
	public $domain = array();
	public $subdomains = array();
	public $message = array();
	public $data = array();
	public $actions = array();
	public $executed_actions = array();
	public $get = array();
	public $post = array();
	public $var = array();

	private $scene;
	private $module;
	private $exit_mode = '';
	private $language = '';
	private $Debug;


	/**
	 * public function __construct (void)
	 */
	public function __construct () {
		global $Debug;

		$this->Debug = $Debug;
	}


	/**
	 * public function overload (void)
	 *
	 * return boolean
	 */
	public function overload () {
		if (isset($_SERVER['CONTENT_LENGTH'])) {
			$size = trim(strtolower(ini_get('upload_max_filesize')));
			$last = substr($size, -1);
			$size = intval($size);

			switch ($last) {
				case 'g':
					$size *= 1024;
				case 'm':
					$size *= 1024;
				case 'k':
					$size *= 1024;
			}

			if ($_SERVER['CONTENT_LENGTH'] > $size) {
				return true;
			}
		}

		return false;
	}


	/**
	 * public function load (void)
	 *
	 * Load all vars
	 *
	 * return none
	 */
	public function load () {
		//Get path
		$url = preg_replace('|^'.BASE_WWW.'|', '', getenv('REQUEST_URI'));
		$url = str_replace('$', '', parse_url($url, PHP_URL_PATH));

		list($url, $actions) = explode(':', $url, 2);

		if ($actions) {
			foreach (explode(',', $actions) as $action) {
				$action = trim($action);

				if ($action) {
					$this->actions[$action] = null;
				}
			}
		}

		$url = explode('/', $url);

		//route
		$this->path = array();

		foreach ($url as $value) {
			if (!empty($value)) {
				$this->path[] = trim(urldecode($value));
			}
		}

		if (!$this->path) {
			$this->path[] = 'index';
		}

		//Variables
		$get = (array)filter_input_array(INPUT_GET);
		$post = arrayMergeReplaceRecursiveStrict($this->arrayFiles(), (array)filter_input_array(INPUT_POST));

		$this->get = array_keys($get);
		$this->post = array_keys($post);
		$this->var = arrayMergeReplaceRecursiveStrict($get, $post);

		//Save the actions
		foreach ((array)$this->var['phpcan_action'] as $action_name => $action_value) {
			if (is_int($action_name)) {
				$action_name = $action_value;
				$action_value = null;
			}

			$action_name = trim($action_name);

			if ($action_name) {
				$this->actions[$action_name] = $action_value;
			}
		}

		$this->delete('phpcan_action');

		//Save the current subdomains
		$this->domain = getenv('SERVER_NAME');

		if (preg_match('/localhost$/', $this->domain)) {
			$this->subdomains = array_reverse(explode('.', str_replace('.localhost', '', $this->domain)));
		} else {
			// FIX: problem with domains with double extension: co.uk
			$this->subdomains = array_reverse(explode('.', preg_replace('/[a-z0-9-]+\.([a-z]{2,4})+$/', '', $this->domain)));
			array_shift($this->subdomains);
		}
	}


	/**
	 * public function actionWasSent (string $action)
	 *
	 * return boolean
	 */
	public function actionWasSent ($action) {
		return array_key_exists($action, $this->actions);
	}


	/**
	 * public function actionWasExecuted (string $action)
	 *
	 * return boolean
	 */
	public function actionWasExecuted ($action) {
		return array_key_exists($action, $this->executed_actions);
	}


	/**
	 * public function actionReturn (string $action)
	 *
	 * return mixed
	 */
	public function actionReturn ($action) {
		return $this->executed_actions[$action];
	}


	/**
	 * private function arrayFiles (void)
	 *
	 * Fix the order data of the array $_FILES
	 *
	 * return array
	 */
	private function arrayFiles () {
		if (!$_FILES) {
			return array();
		}

		$array_files = array();

		foreach ($_FILES as $name => $values) {
			if (!is_array(current($values))) {
				$array_files[$name] = $values;

				continue;
			}

			foreach ($values as $type_info => $info) {
				$array_files[$name] = arrayMergeReplaceRecursiveStrict($array_files[$name], $this->_arrayFiles($info, $type_info));
			}
		}

		return $array_files;
	}


	/**
	 * private function _arrayFiles (void)
	 *
	 * To execute recursively from arrayFiles
	 *
	 * return array
	 */
	private function _arrayFiles ($array, $last) {
		$return = array();

		foreach ($array as $key => $value) {
			if (is_array($value)) {
				$return[$key] = $this->_arrayFiles($value, $last);
			} else {
				$return[$key][$last] = $value;
			}
		}

		return $return;
	}


	/**
	 * public function get (string/int/array $name, [string $filter])
	 *
	 * return mixed
	 */
	public function get ($name, $filter = null) {
		if (is_array($name)) {
			$return = array();

			foreach ($name as $key => $value) {
				if (is_int($key)) {
					$return[$value] = $this->get($value, $filter);
				} else {
					$return[$key] = $this->get($key, $value);
				}
			}

			return $return;
		}

		if (strpos($name, '[') && strpos($name, ']')) {
			$name = explode('[', str_replace(']', '', $name));
			$return = $this->var;

			while ($name) {
				$return = $return[array_shift($name)];
			}
		} else {
			$return = $this->var[$name];
		}

		if (is_array($return) || !$filter) {
			return $return;
		}

		$filter = $this->getSanitizeFilter($filter);

		return filter_var($return, $filter[0], $filter[1]);
	}


	/**
	* function getGetVars ([string $name], [string $value], [bool $add_all_get_variables])
	* function getGetVars ([array $values], [bool $add_all_get_variables])
	*
	* Return string
	*/
	function getGetVars ($name = null, $value = true, $add_all_get_variables = true) {
		$values = array();
		$null = array();

		if (!is_null($name)) {
			if (is_array($name)) {
				$add_all_get_variables = $value;

				foreach ($name as $k => $v) {
					if (is_int($k)) {
						if (in_array($v, $this->get)) {
							$values[$v] = $this->var[$v];
						}

					} else if (is_null($v)) {
						$null[] = $k;
					} else {
						$values[$k] = $v;
					}
				}

			} else if (is_null($value)) {
				$null[] = $name;
			} else {
				$values[$name] = $value;
			}
		}

		if ($add_all_get_variables === true) {
			foreach ($this->get as $name) {
				if (!isset($values[$name])) {
					$values[$name] = $this->var[$name];
				}
			}
		}
		
		if ($null) {
			foreach ($null as $name) {
				unset($values[$name]);
			}
		}

		return $values;
	}


	/**
	 * public function set (string/int $name, mixed $value)
	 *
	 * return mixed
	 */
	public function set ($name, $value) {
		$this->var[$name] = $value;
	}


	/**
	 * public function int (string/int $name)
	 *
	 * return integer
	 */
	public function int ($name) {
		return $this->get($name, 'int');
	}

	/**
	 * public function str (string/int $name)
	 *
	 * return string
	 */
	public function str ($name) {
		return trim($this->get($name, 'string'));
	}


	/**
	 * public function arr (string/int $name)
	 *
	 * return array
	 */
	public function arr ($name) {
		$arr = $this->get($name);

		if (is_null($arr)) {
			return array();
		}

		return (array)$arr;
	}


	/**
	 * public function bool (string/int $name)
	 *
	 * return boolean
	 */
	public function bool ($name) {
		return $this->get($name, 'bool');
	}



	/**
	 * public function setCookie (string $name, string $value, [int $duration])
	 *
	 * return boolean
	 */
	public function setCookie ($name, $value, $duration = null) {
		if (is_null($duration)) {
			$duration = 86400; //one day
		}

		return setcookie($name, $value, time() + $duration, BASE_WWW);
	}


	/**
	 * public function getCookie (string $name, [string $filter])
	 *
	 * return boolean
	 */
	public function getCookie ($name, $filter = '') {
		$filter = $this->getSanitizeFilter($filter);

		return filter_input(INPUT_COOKIE, $name, $filter[0], $filter[1]);
	}


	/**
	 * public function deleteCookie (string $name)
	 *
	 * return boolean
	 */
	public function deleteCookie ($name) {
		return setcookie($name, '', 1, BASE_WWW);
	}


	/**
	 * private function getSanitizeFilter ($name)
	 *
	 * return int
	 */
	private function getSanitizeFilter ($name) {
		switch ($name) {
			case 'string':
			return array(FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);

			case 'int':
			return array(FILTER_SANITIZE_NUMBER_INT);

			case 'bool':
			return array(FILTER_VALIDATE_BOOLEAN);

			case 'float':
			return array(FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);

			case 'special_chars':
			return array(FILTER_SANITIZE_SPECIAL_CHARS);

			case 'encoded':
			return array(FILTER_SANITIZE_ENCODED);

			case 'url':
			return array(FILTER_SANITIZE_URL);

			case 'email':
			return array(FILTER_SANITIZE_EMAIL);
		}

		return array(FILTER_UNSAFE_RAW);
	}

	/**
	 * public function is (string $type, mixed $name)
	 *
	 * return boolean
	 */
	public function is ($type, $name) {
		if (!isset($this->var[$name])) {
			return false;
		}

		$value = $this->var[$name];

		switch ($type) {
			case 'int':
			return (filter_var($value, FILTER_VALIDATE_INT) === false) ? false : true;

			case 'bool':
			return is_null(filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) ? false : true;

			case 'float':
			return (filter_var($value, FILTER_VALIDATE_FLOAT) === false) ? false : true;

			case 'url':
			return (filter_var($value, FILTER_VALIDATE_URL) === false) ? false : true;

			case 'email':
			return (filter_var($value, FILTER_VALIDATE_EMAIL) === false) ? false : true;
		}
	}


	/**
	 * public function isInt ($name)
	 *
	 * return boolean
	 */
	public function isInt ($name) {
		return $this->is('int', $name);
	}


	/**
	 * public function isBool ($name)
	 *
	 * return boolean
	 */
	public function isBool ($name) {
		return $this->is('bool', $name);
	}


	/**
	 * public function isFloat ($name)
	 *
	 * return boolean
	 */
	public function isFloat ($name) {
		return $this->is('float', $name);
	}


	/**
	 * public function isUrl ($name)
	 *
	 * return boolean
	 */
	public function isUrl ($name) {
		return $this->is('url', $name);
	}


	/**
	 * public function isEmail ($name)
	 *
	 * return boolean
	 */
	public function isEmail ($name) {
		return $this->is('email', $name);
	}


	/**
	 * private function pathShift (void)
	 */
	private function pathShift () {
		array_shift($this->path);

		if (!$this->path) {
			$this->path[] = 'index';
		}
	}


	/**
	 * public function setRoute ()
	 *
	 * Set route and return its config
	 *
	 * return array
	 */
	public function setRoute () {
		global $Config;

		$routes = $Config->routes;

		$this->route_config = array();

		//Detect regular expressions
		$url = implode('/', $this->path).'/';
		$route_list = array();
		$undefined = true;

		$search = array(
			//'% ?#\w+$%', //Remove exit_modes
			'%([^/])$%', //Put "/" at the end if doesn't exists
			'%\.(\?)?/%', //Replace "./"
			'%\*%', //Replace "*/"
			'%\$[\w-]+(\?)?/%', //Replace $var/
			'%\$[\w-]+:int(\?)?%' //Replace $var:int/
		);

		$replace = array(
			//'',
			'\1/',
			'([^/]+/)\1',
			'(.+)?',
			'([^/]+/)\1',
			'([0-9]+)\1'
		);

		foreach ((array)$routes as $route => $settings) {
			$route_regexp = preg_replace($search, $replace, $route);

			if (preg_match('%^'.$route_regexp.'$%', $url)) {
				$this->route_config[$route] = $settings;

				if ($route != '*') {
					$undefined = false;
					$route_list[] = $route;
				}
			}
		}

		if ($undefined) {
			$this->route_config['undefined'] = $routes['undefined'];

			$this->var += $this->path;

			return false;
		}

		//Parse config_list
		$path_total = 0;

		foreach ($route_list as $route) {
			$this_route = explode('/', $route);

			foreach ($this_route as $i => $section) {
				if ($section == '*') {
					continue;
				}

				if ($i > $path_total) {
					$path_total = $i;
				}

				//Get vars
				if ($section[0] == '$') {
					$section = str_replace('$', '', $section);

					if (strstr($section, ':int')) {
						$section = str_replace(':int', '', $section);
						$this->path[$i] = intval($this->path[$i]);
					}

					$this->var[$section] = $this->path[$i];
				}

				$this->route[$i] = $section;
			}
		}

		if ($path_total < (count($this->path) - 1)) {
			$this->var += array_slice($this->path, ($path_total + 1));
		}

		return true;
	}


	/**
	 * function getRoute ([int $index], [int $compare])
	 *
	 * returns the $this->route value
	 *
	 * return boolean/string
	 */
	public function getRoute ($index = null, $compare = null) {
		if (is_null($index)) {
			return $this->route;
		}

		if (is_null($compare)) {
			return $this->route[$index];
		}

		return ($this->route[$index] == $compare) ? true : false;
	}


	/**
	 * function getPath ([int $index], [int $compare])
	 *
	 * returns the $this->path value
	 *
	 * return boolean/string
	 */
	public function getPath ($index = null, $compare = null) {
		if (is_null($index)) {
			return $this->path;
		}

		if (is_null($compare)) {
			return $this->path[$index];
		}

		return ($this->path[$index] == $compare) ? true : false;
	}


	/**
	 * public function delete (string/int $name)
	 *
	 * Delete a variable
	 */
	public function delete ($name) {
		if ($name === 0 || $name === '0') {
			array_shift($this->var);
		} else {
			unset($this->var[$name]);
		}

		unset($_GET[$name], $_POST[$name], $_FILES[$name], $_COOKIE[$name]);
	}


	/**
	 * public function setScene (void)
	 *
	 * Detect the current scene
	 *
	 * return boolean
	 */
	public function setScene () {
		global $Config;

		$scenes = $Config->scenes;

		if (!$scenes) {
			$this->Debug->fatalError('vars', 'There is not any scene defined');
		}

		//Get scene by subfolder
		$scene = strtolower($this->path[0]);

		if ($scene && $scenes[$scene]['detect'] == 'subfolder') {
			$this->scene = $scene;
			$this->pathShift();

			return true;
		}

		//Get scene by subdomain
		$scene = current($this->subdomains);

		if ($scene && $scenes[$scene]['detect'] == 'subdomain') {
			$this->scene = $scene;
			array_shift($this->subdomains);

			return true;
		}

		//Get default scene
		foreach ($scenes as $scene => $settings) {
			if ($settings['default']) {
				$this->scene = $scene;

				return true;
			}
		}

		//Get first scene
		$this->scene = key($scenes);

		return true;
	}


	/**
	 * public function getScene ([string $scene])
	 *
	 * returns the $this->scene value
	 *
	 * return boolean/string
	 */
	public function getScene ($scene = '') {
		if (!$scene) {
			return $this->scene;
		} else {
			return ($this->scene == $scene) ? true : false;
		}
	}


	/**
	 * public function getSceneConfig ([string $variable], [string $compare])
	 *
	 * returns the config of $this->scene
	 *
	 * return boolean/string/array
	 */
	public function getSceneConfig ($variable = '', $compare = '') {
		global $Config;

		if (!$variable) {
			return $Config->scenes[$this->scene];
		}

		if ($compare) {
			return ($Config->scenes[$this->scene][$variable] == $compare) ? true : false;
		}

		return $Config->scenes[$this->scene][$variable];
	}


	/**
	 * public function setModule (void)
	 *
	 * Detect the current module
	 *
	 * return boolean
	 */
	public function setModule () {
		global $Config;

		$modules = $Config->scenes[$this->getScene()]['modules'];

		if (!$modules) {
			return false;
		}

		//Get module by subfolder
		$module = strtolower($this->path[0]);

		if ($module && $modules[$module]['detect'] == 'subfolder') {
			$this->module = $module;
			$this->pathShift();

			return true;
		}

		//Get module by subdomain
		$module = current($this->subdomains);

		if ($module && $modules[$module]['detect'] == 'subdomain') {
			$this->module = $module;
			array_shift($this->subdomains);

			return true;
		}

		return false;
	}


	/**
	 * public function getModule ([string $module])
	 *
	 * returns the $this->module value
	 *
	 * return boolean/string
	 */
	public function getModule ($module = '') {
		if (!$module) {
			return $this->module;
		} else {
			return ($this->module == $module) ? true : false;
		}
	}


	/**
	 * public function getModuleConfig ([string $variable], [string $compare])
	 *
	 * returns the config of $this->module
	 *
	 * return boolean/string/array
	 */
	public function getModuleConfig ($variable = '', $compare = '') {
		global $Config;

		if (!$variable) {
			return $Config->scenes[$this->getScene()]['modules'][$this->module];
		}

		if ($compare) {
			return ($Config->scenes[$this->getScene()]['modules'][$this->module][$variable] == $compare) ? true : false;
		}

		return $Config->scenes[$this->getScene()]['modules'][$this->module][$variable];
	}


	/**
	 * public function setLanguage (string $lang)
	 *
	 * Detect the current language
	 *
	 * return boolean
	 */
	public function setLanguage ($lang = '') {
		global $Config;

		$languages = array();

		foreach ((array)$Config->languages['availables'] as $language => $active) {
			if ($active) {
				$languages[] = $language;
			}
		}

		if (!$languages) {
			return false;
		}

		$language_var = 'phpcan_language_'.$this->scene;

		if ($this->module) {
			$language_var .= '_'.$this->module;
		}

		$cookie_time = 3600*24*365;

		//Set language directly
		if ($lang && in_array($lang, $languages)) {
			$language = $lang;

			if ($this->getCookie($language_var) != $this->language) {
				$this->setCookie($language_var, $this->language, $cookie_time);
			}

			return true;
		}

		//Detect language
		switch($Config->languages['detect']) {
			case 'subfolder':
				$language = $this->path[0];

				if (in_array($language, $languages)) {
					$this->language = $language;
					$this->pathShift();
				}
				break;

			case 'get':
				$language = $this->str('lang');

				if (in_array($language, $languages)) {
					$this->language = $language;
				}
				break;

			case 'subdomain':
				$language = current($this->subdomains);

				if (in_array($language, $languages)) {
					$this->language = $language;
					array_shift($this->subdomains);
				}
				break;
		}

		//If language was detected
		if ($this->language) {
			//Save cookie
			if ($this->getCookie($language_var) != $this->language) {
				$this->setCookie($language_var, $this->language, $cookie_time);
			}

			return true;
		}

		//Language cookie
		if ($this->getCookie($language_var)) {
			$language = $this->getCookie($language_var);

			if (in_array($language, $languages)) {
				$this->language = $language;

				return true;
			}
		}

		//Default config
		if ($Config->languages['default']) {
			$language = $Config->languages['default'];

			if (in_array($language, $languages)) {
				$this->language = $language;

				$this->setCookie($language_var, $this->language, $cookie_time);

				return true;
			}
		}

		//Browser language
		$language = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));

		if (in_array($language, $languages)) {
			$this->language = $language;

			$this->setCookie($language_var, $this->language, $cookie_time);

			return true;
		}

		//First available language
		$this->language = key($languages);

		$this->setCookie($language_var, $this->language, $cookie_time);

		return true;
	}


	/**
	 * function getLanguage ([string $language])
	 *
	 * returns the $this->language value
	 *
	 * return boolean/string
	 */
	public function getLanguage ($language = '') {
		if (!$language) {
			return $this->language;
		} else {
			return ($this->language ==  $language) ? true : false;
		}
	}


	/**
	 * public function setExitMode (void)
	 *
	 * Asign $this->exit_mode value
	 *
	 * return true
	 */
	public function setExitMode () {
		global $Config;

		$exit_modes = $Config->exit_modes;

		//Detect by phpcan_exit_mode variable
		if ($this->var['phpcan_exit_mode'] && $exit_modes[$this->var['phpcan_exit_mode']]) {
			$this->exit_mode = $this->str('phpcan_exit_mode');
			$this->delete('phpcan_exit_mode');

			//Remove from route too
			if ($this->path[0] == $this->exit_mode) {
				$this->pathShift();
			}

			return true;
		}

		//Detect by path
		if ($this->path[0] && $exit_modes[$this->path[0]]) {
			$this->exit_mode = $this->path[0];
			$this->pathShift();

			return true;
		}

		//Autodetect ajax
		if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' && $exit_modes['ajax']) {
			$this->exit_mode = 'ajax';

			return true;
		}

		//Get the default exit_mode
		foreach ($exit_modes as $exit_mode => $settings) {
			if ($settings['default']) {
				$this->exit_mode = $exit_mode;
				return true;
			}
		}

		//Get the first exit mode by default
		$this->exit_mode = key($exit_modes);

		return true;
	}


	/**
	 * function getExitMode ([string $exit_mode])
	 *
	 * returns the $this->exit_mode value
	 *
	 * return boolean/string
	 */
	public function getExitMode ($exit_mode = '') {
		if (!$exit_mode) {
			return $this->exit_mode;
		} else {
			return ($this->exit_mode ==  $exit_mode) ? true : false;
		}
	}


	/**
	 * function getExitModeConfig ([string $variable], [string $compare])
	 *
	 * returns the config of $this->exit_mode
	 *
	 * return boolean/string/array
	 */
	public function getExitModeConfig ($variable = '', $compare = '') {
		global $Config;

		if (!$variable) {
			return $Config->exit_modes[$this->exit_mode];
		}

		if ($compare) {
			return ($Config->exit_modes[$this->exit_mode][$variable] == $compare) ? true : false;
		}

		return $Config->exit_modes[$this->exit_mode][$variable];
	}


	/**
	 * function loadMessage (void)
	 *
	 * load the message var
	 */
	public function loadMessage () {
		$this->message['inbox'] = $this->getCookie('phpcan_message');
		$this->message['type'] = $this->getCookie('phpcan_message_type');
		$this->message['outbox'] = '';

		$this->deleteCookie('phpcan_message');
		$this->deleteCookie('phpcan_message_type');
	}


	/**
	 * function message ([string $message], [string $type])
	 *
	 * save/return a message
	 *
	 * return string
	 */
	public function message ($message = '', $type = '') {
		if (empty($message)) {
			return $this->message['inbox'];
		} else {
			$this->message['inbox'] = $message;
			$this->message['outbox'] = $message;
			$this->message['type'] = $type;
		}
	}

	/**
	 * function messageExists (void)
	 *
	 * return boolean
	 */
	public function messageExists () {
		return $this->message['inbox'] ? true : false;
	}

	/**
	 * function messageType (string $type)
	 *
	 * return boolean or string
	 */
	public function messageType ($type = '') {
		if (empty($type)) {
			return $this->message['type'];
		} else {
			return ($this->message['type'] == $type) ? true : false;
		}
	}

	/**
	 * public function exists (string/int $name)
	 *
	 * return boolean
	 */
	public function exists ($name) {
		if (strpos($name, '[') && strpos($name, ']')) {
			$name = preg_replace('/^([^\[]+)/', '[\\1]', $name);
			$name = str_replace(array('[', ']'), array('["', '"]'), $name);
			$name = preg_replace('/(\["([0-9]+)"\])+/', '[\\2]', $name);

			eval('$return = isset($this->var'.$name.');');

			return $return;
		}

		return isset($this->var[$name]);
	}


	/**
	 * public function setData (string $name, mixed $value, [mixed $default])
	 *
	 * return false/mixed
	 */
	public function setData ($name, $value = array(), $default = array()) {
		if (empty($name)) {
			return false;
		}

		$name = preg_replace('/\W/', '_', strtolower($name));

		global $$name;

		if (!$value && $default) {
			$value = $default;
		}

		$$name = $value;
		$this->data[] = $name;

		return $$name;
	}


	/**
	 * public function getData ([string $name])
	 *
	 * return false/mixed
	 */
	public function getData ($name = null) {
		if (is_null($name)) {
			$return = array();

			foreach ($this->data as $name) {
				$return[$name] = $this->getData($name);
			}

			return $return;
		}

		$name = preg_replace('/\W/', '_', strtolower($name));

		if (!empty($name) && in_array($name, $this->data)) {
			global $$name;

			if (isset($$name)) {
				return $$name;
			}
		}

		return false;
	}
}
?>
